import { defHttp } from '/@/utils/http/axios';
import { UploadFileParams } from '/#/axios';
import { UploadApiResult } from '../model/baseModel';
const baseAPi = '/DataCenter/';
const baseWebAPi = '/WebAppService/';
const baseWebAPiPro = '/WebApi/';

/**
 * @description: 获取路径和日志
 */
export function getSystemConfig() {
  return defHttp.post({ url: `${baseAPi}GetSystemConfig` });
}
/**
 * @description: 设置路径和日志
 */
export function setSystemConfig(data) {
  return defHttp.post({ url: `${baseAPi}SetSystemConfig`, data });
}

/**
 * @description: 获取api服务
 */
export function getApiServer() {
  return defHttp.post({ url: `${baseAPi}GetDataCenterConfig` });
}

/**
 * @description: 设置api服务
 */
export function setApiServer(data) {
  return defHttp.post({ url: `${baseAPi}SetDataCenterConfig`, data });
}
/**
 * @description: 获取webApp服务
 */
export function getWebAppConfig() {
  return defHttp.post({ url: `${baseWebAPi}GetWebAppConfig` });
}

/**
 * @description: 设置webApp服务
 */
export function setWebAppConfig(data) {
  return defHttp.post({ url: `${baseWebAPi}SetWebAppConfig`, data });
}
/**
 * @description: 获取系统版本
 */
export function getSysEnvironment() {
  return defHttp.post({ url: `${baseAPi}GetSysEnvironment` });
}
/**
 * @description: 上传文件
 */
export function uploadApi(
  params: UploadFileParams,
  onUploadProgress: (progressEvent: ProgressEvent) => void,
) {
  return defHttp.uploadFile<UploadApiResult>(
    {
      url: `${baseWebAPiPro}UploadFile`,
      onUploadProgress,
    },
    params,
  );
}
